<?php

namespace App\Http\Controllers\Admin;

use App\Http\Requests\BridgeLevelRequest;
use App\Models\BridgeLevel;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class BridgeLevelsController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return BridgeLevel::get();
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(BridgeLevelRequest $request)
    {
        return BridgeLevel::create($request->only('name', 'sort'));
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit(BridgeLevel $bridgeLevel)
    {
        return $bridgeLevel;
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(BridgeLevelRequest $request, BridgeLevel $bridgeLevel)
    {
        $bridgeLevel->update($request->only('name', 'sort'));
        return $bridgeLevel;
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy(BridgeLevel $bridgeLevel)
    {
        $bridgeLevel->delete();
    }
}
